package org.pahema.dao.impl;

import org.hibernate.SessionFactory;
import org.pahema.dao.ComprobanteDAO;
import org.pahema.model.Comprobante;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
public class ComprobanteDAOImpl implements ComprobanteDAO {

	@Autowired
	private SessionFactory sessionFactory;
	
	private HibernateTemplate hibernateTemplate;
	
	public void setSessionFactory(SessionFactory sessionFactory){
		this.hibernateTemplate = new HibernateTemplate(sessionFactory);
	}
	
	
	@Override
	@Transactional
	public void guardarComprobante(Comprobante comprobante) {
		hibernateTemplate.save(comprobante);
	}
	
}
